package com.nondo.rdp.finance.domain.activity;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.Transient;
import javax.validation.constraints.NotNull;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonSetter;
import com.nondo.rdp.auth.domain.User;
import com.nondo.rdp.core.domain.base.BaseEntity;
import com.nondo.rdp.finance.config.DbConfig;
import com.nondo.rdp.finance.domain.course.Course;

/**
 * 营销-课程
 */
@Entity
@Table(name = DbConfig.DEFAULT_TABLE_PREFIX + "market_course")
public class MarketCourse extends BaseEntity {
	private static final long serialVersionUID = -335565985402706610L;
	private Long id;// 主键
    private Course course;// 课程
    private Integer type; //类型 0|解套
    private User user;//发布者
    
    //扩展字段
    private String cid; // 课程ID
    private String name; //课程名称

    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    @OneToOne
	public Course getCourse() {
		return course;
	}

	public void setCourse(Course course) {
		this.course = course;
	}

	@Column(columnDefinition = "int default 0", length = 2)
	public Integer getType() {
		return type;
	}

	public void setType(Integer type) {
		this.type = type;
	}

	@OneToOne
	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}

	@JsonIgnore
	@Transient
	public String getCid() {
		return cid;
	}

	@JsonSetter
	public void setCid(String cid) {
		this.cid = cid;
	}

	@JsonIgnore
	@Transient
	public String getName() {
		return name;
	}

	@JsonSetter
	public void setName(String name) {
		this.name = name;
	}

}
